import Vue from 'vue';
import VueRouter from 'vue-router'
// tabbar栏
import home from './components/tabbar/home.vue'
import user from './components/tabbar/user.vue'
import cart from './components/tabbar/cart.vue'
import search from './components/tabbar/search.vue'
// 新闻
import newslist from './components/news/NewsList.vue'
import newsinfo from './components/news/NewsInfo.vue'
// 图片
import photoslist from './components/photos/photoslist.vue'
import photosinfo from './components/photos/photosinfo.vue'
// 商品
import goodslist from './components/shopgoods/goodslist.vue'
import goodsinfo from './components/shopgoods/goodsinfo.vue'
import goodssubcomment from './components/shopgoods/goodssubcomment.vue'
import goodsdesc from './components/shopgoods/goodsdesc.vue'


Vue.use(VueRouter)
// 3. 创建路由对象
var router = new VueRouter({
  routes: [
    { path:'/',redirect:'/home'},
   { path:'/home',component:home},
   { path:'/user',component:user},
   { path:'/cart',component:cart},
   { path:'/search',component:search},
   { path:'/news/newslist',component:newslist},
   { path:'/news/info/:id',component:newsinfo},
   { path:'/home/photoslist',component:photoslist},
   { path:'/photosinfo/:id',component:photosinfo},
   { path:'/home/goodlist',component:goodslist},
 
  //  以前的设置路由方式
  //  { path:'/goodslist/goodsinfo/:id',component:goodsinfo}
  // 现在使用导航式编程
  { path:'/goodslist/goodsinfo/:id',component:goodsinfo,name:'goodsinfo'},
  { path:'/goodslist/goodssubcomment/:id',component:goodssubcomment,name:'goodssubcomment'},
  { path:'/goodsinfo/goodsdesc/:id', component:goodsdesc,name:'goodsdesc'}
  ],
  linkActiveClass:'mui-active'
})

// 把路由对象暴露出去
export default router